#include <stdio.h>
#include <string.h>

void func(int n, char *str)
{
    int length = strlen(str);
    char temp[length + 1];
    for (int i = n; i >= 1; i--)
    {
        temp[i - 1] = str[length - i];
    }
    for (int i = 0; i < length - n; i++)
    {
        temp[n + i] = str[i];
    }
    temp[length] = '\0';
    printf("%s", temp);
}

int main()
{
    int n = 2;
    char str[100] = "hello world";

    func(n, str);

    return 0;
}